<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>采购入库页面</title>
		<link rel="stylesheet" href="../../lib/layui/css/layui.css" media="all">
	</head>

	<body>
		<form class="layui-form" action="">
			<div class="layui-form-item">
				<label class="layui-form-label">采购计划ID:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="purchasingplan_id" name="purchasingplan_id" required lay-verify="required" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">供应商:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="supplier_id" name="supplier_id" required lay-verify="required" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">采购部门</label>
				<div class="layui-input-block">
					<input type="text" name="purchasing_department" id="purchasing_department" required
						lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">计划日期</label>
				<div class="layui-input-block">
					<input type="text" name="purchasingplan_date" id="purchasingplan_date" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">计划人</label>
				<div class="layui-input-block">
					<input type="text" name="planer_id" id="planer_id" required lay-verify="required" placeholder="请输入标题"
						autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">备注</label>
				<div class="layui-input-block">
					<input type="text" name="reamrks" id="reamrks" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">录入日期</label>
				<div class="layui-input-block">
					<input type="text" name="create_date" id="create_date" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">审核者</label>
				<div class="layui-input-block">
					<input type="text" name="uname" id="uname" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">审核状态</label>
				<div class="layui-input-block">
					<input type="text" name="inspector_status" id="inspector_status" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">是否处理</label>
				<div class="layui-input-block">
					<input type="text" name="if_handle" id="if_handle" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
		<table id="demo" lay-filter="test"></table>

		<script src="../../layui/layui.js"></script>
		<script src="../../js/User.js" type="text/javascript" charset="utf-8"></script>
		<script>
			//Demo
			layui.use(['form', 'laydate'], function() {

				var form = layui.form;
				var laydate = layui.laydate;
				var $ = layui.$;
				laydate.render({
					elem: '#purchasingplan_date',
					type: 'datetime',
					trigger: 'click' //采用click弹出
						,
					calendar: true

				});
				laydate.render({
					elem: '#create_date',
					type: 'datetime',
					trigger: 'click' //采用click弹出
						,
					calendar: true

				});
				$.getJSON(globalData.server + "Alarm/getAdminUser", function(res) {
					console.log(res);
					if (res.data.length > 0) {
						for (var i = 0; i < res.data.length; i++) {
							$("#inspectorId").append(new Option(res.data[i].name, res.data[i].id));
						}
						form.render('select');
					}
				})
				//监听提交
				form.on('submit(formDemo)', function(data) {
					$.post(globalData.server + "Pur/AddPurDetailsFind", data.field, function(obj) {
						if (obj.count > 0) {
							//假设这是iframe页
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							parent.layer.close(index); //再执行关闭        

						}
					})
					return false;
				});
			});
		</script>
	</body>

</html>
